package Simulation;

import Config.Config;
import People.People;

/**
 * Abstract class containing methods
 * 
 * @author user
 */
public abstract class Manager {
	/**
	 * Swaps two coordinate's People
	 * 
	 * @param people1
	 * @param people2
	 */
	public void switchPeople(People people1, People people2) {
		People peopleTemp = people1.clone();
		people1.copyFrom(people2);
		people2.copyFrom(peopleTemp);
	}

	/**
	 * Writes status in the health record
	 * 
	 * @param map
	 */
	public void writeStatus(Map map) {
		for (int x = 0; x < Config.MAP_HEIGTH; x++) {
			for (int y = 0; y < Config.MAP_LENGTH; y++) {
				map.getMapSimulation()[x][y].addStatus();
			}
		}
	}

	/**
	 * Return n mod(modulo)
	 * 
	 * @param n
	 *            number
	 * @param modulo
	 *            modulo
	 * @return
	 */
	public static int mod(int n, int modulo) {
		int res = n % modulo;
		if (res < 0 && modulo > 0) {
			res += modulo;
		}
		return res;
	}
}
